/*
Copyright 2022 The Numaproj Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// Code generated by Openapi Generator. DO NOT EDIT.

/// Scale : Scale defines the parameters for autoscaling.

#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Scale {
    /// Whether to disable autoscaling. Set to \"true\" when using Kubernetes HPA or any other 3rd party autoscaling strategies.
    #[serde(rename = "disabled", skip_serializing_if = "Option::is_none")]
    pub disabled: Option<bool>,
    /// Lookback seconds to calculate the average pending messages and processing rate.
    #[serde(rename = "lookbackSeconds", skip_serializing_if = "Option::is_none")]
    pub lookback_seconds: Option<i64>,
    /// Maximum replicas.
    #[serde(rename = "max", skip_serializing_if = "Option::is_none")]
    pub max: Option<i32>,
    /// Minimum replicas.
    #[serde(rename = "min", skip_serializing_if = "Option::is_none")]
    pub min: Option<i32>,
    /// DeprecatedReplicasPerScale defines the number of maximum replicas that can be changed in a single scale up or down operation. The is use to prevent from too aggressive scaling operations Deprecated: Use ReplicasPerScaleUp and ReplicasPerScaleDown instead
    #[serde(rename = "replicasPerScale", skip_serializing_if = "Option::is_none")]
    pub replicas_per_scale: Option<i64>,
    /// ReplicasPerScaleDown defines the number of maximum replicas that can be changed in a single scaled down operation. The is use to prevent from too aggressive scaling down operations
    #[serde(
        rename = "replicasPerScaleDown",
        skip_serializing_if = "Option::is_none"
    )]
    pub replicas_per_scale_down: Option<i64>,
    /// ReplicasPerScaleUp defines the number of maximum replicas that can be changed in a single scaled up operation. The is use to prevent from too aggressive scaling up operations
    #[serde(rename = "replicasPerScaleUp", skip_serializing_if = "Option::is_none")]
    pub replicas_per_scale_up: Option<i64>,
    /// ScaleDownCooldownSeconds defines the cooldown seconds after a scaling operation, before a follow-up scaling down. It defaults to the CooldownSeconds if not set.
    #[serde(
        rename = "scaleDownCooldownSeconds",
        skip_serializing_if = "Option::is_none"
    )]
    pub scale_down_cooldown_seconds: Option<i64>,
    /// ScaleUpCooldownSeconds defines the cooldown seconds after a scaling operation, before a follow-up scaling up. It defaults to the CooldownSeconds if not set.
    #[serde(
        rename = "scaleUpCooldownSeconds",
        skip_serializing_if = "Option::is_none"
    )]
    pub scale_up_cooldown_seconds: Option<i64>,
    /// TargetBufferAvailability is used to define the target percentage of the buffer availability. A valid and meaningful value should be less than the BufferUsageLimit defined in the Edge spec (or Pipeline spec), for example, 50. It only applies to UDF and Sink vertices because only they have buffers to read.
    #[serde(
        rename = "targetBufferAvailability",
        skip_serializing_if = "Option::is_none"
    )]
    pub target_buffer_availability: Option<i64>,
    /// TargetProcessingSeconds is used to tune the aggressiveness of autoscaling for source vertices, it measures how fast you want the vertex to process all the pending messages. Typically increasing the value, which leads to lower processing rate, thus less replicas. It's only effective for source vertices.
    #[serde(
        rename = "targetProcessingSeconds",
        skip_serializing_if = "Option::is_none"
    )]
    pub target_processing_seconds: Option<i64>,
    /// After scaling down the source vertex to 0, sleep how many seconds before scaling the source vertex back up to peek.
    #[serde(
        rename = "zeroReplicaSleepSeconds",
        skip_serializing_if = "Option::is_none"
    )]
    pub zero_replica_sleep_seconds: Option<i64>,
}

impl Scale {
    /// Scale defines the parameters for autoscaling.
    pub fn new() -> Scale {
        Scale {
            disabled: None,
            lookback_seconds: None,
            max: None,
            min: None,
            replicas_per_scale: None,
            replicas_per_scale_down: None,
            replicas_per_scale_up: None,
            scale_down_cooldown_seconds: None,
            scale_up_cooldown_seconds: None,
            target_buffer_availability: None,
            target_processing_seconds: None,
            zero_replica_sleep_seconds: None,
        }
    }
}
